<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="div-id"></div>
  <div class="div-class"></div>
  <div class="div-class"></div>

  <script>
    let elem, elems

    // getElementsByTagName
    elems = document.getElementsByTagName('div')
    console.log(elems)

    // getElementById
    elem = document.getElementById('div-id')
    console.log(elem)

    // getElementsByClassName
    elems = document.getElementsByClassName('div-class')
    console.log(elems)
  </script>
</body>

</html>